<template>
    <div class="header" @click="showDetail = true">
        <div class="content-wrapper">
            <div class="avatar">
                <img :src="seller.avatar" alt="">
            </div>
            <div class="content">
                <div class="title">
                    <span class="brand">

                    </span>
                    <span class="name">
                        {{ seller.name }}
                    </span>
                </div>
                <div class="description">
                    {{ seller.description }}/{{ seller.deliveryTime }}分钟送达
                </div>
                <div class="support" v-if="seller.supports">
                    <SupportIcon :type="/*seller.supports && */seller.supports[0].type" size="1"/>
                     <span class="text">{{/*seller.supports && */seller.supports[0].description}}</span>
                </div>
            </div>
            <div class="support-count">
                <span class="count">{{seller.supports && seller.supports.length}}个</span>
                <i class="iconfont icon-youjiantou2"></i>
            </div>
        </div>
        <div class="bulletion-wrapper">
            <span class="bulletion-title"></span>
            <span class="bulletion-text">{{ seller.bulletin }}</span>
            <i class="iconfont icon-youjiantou2"></i>
        </div>
        <div class="bg"></div>
        <!-- detail -->
        <HeaderDetail v-show="showDetail" @hide="handle" :seller="seller"/>
    </div>
    
</template>

<script setup>
import SupportIcon from '@/components/support-ico/index.vue'
import {ref,defineProps, computed} from 'vue'
import HeaderDetail from '@/components/header-detail/Index.vue'

let showDetail = ref(false)

const handle = (e) =>{
    showDetail.value = e
}

const props = defineProps({
  seller: {
    type: Object,
    default: () => ({})
  }
})

const bg = computed(()=>`url('${props.seller.avatar}')`)
</script>

<style lang="less" scoped>
@import '@/assets/variable.less';
@import '@/assets/mixin.less';



    .header{
        .bg{
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background: v-bind(bg) ;
            background-size: 100% 100%;
            z-index: -1;
            filter: blur(10px);

        }
        color:@color-white;
        position: relative;
        background-color: @color-background-ss;

        .content-wrapper{
            display: flex;
            padding: 24px 12px 18px 24px;
            .avatar{
                width: 64px;
                height: 64px;
                border-radius: 5px;
                overflow: hidden;
                img{
                    width: 100%;
                    height: 100%;
                }
            }
            .content{
                flex:1;
                margin-left: 16px;
                .title{
                    margin-bottom: 8px;
                    display: flex;
                    .brand{
                        width: 30px;
                        height: 18px;
                        display: inline-block;
                        // background-image: url(./brand@2x.png);
                        .bg-image('brand');
                        background-size: 100% 100%;
                    }
                    .name{
                        font-size: @fontsize-large;
                        font-weight: bold;
                        margin-left: 6px;

                    }
                }
                .description{
                    font-size: @fontsize-small;
                    margin-bottom: 8px;
                    
                }
                .support{
                    display: flex;
                    align-items: center;
                    .text{
                        font-size: @fontsize-small-s;
                        margin-left: 4px;
                    }
                }
            }
            .support-count{
                position: absolute;
                right: 12px;
                bottom: 40px;
                height: 24px;
                line-height: 24px;
                background-color: @color-background-sss;
                border-radius: 14px;
                padding: 0 8px;
                display: flex;
                align-items: center;
                .count{
                    font-size: @fontsize-small-s;
                    margin-left: 4px;
                }
                .iconfont{
                    font-size: @fontsize-small-s;
                    margin-left: 4px;
                }
            }
        }
        .bulletion-wrapper{
            display: flex;
            align-items: center;
            height: 28px;
            padding: 0 8px;
            background-color:@color-background-sss;
            .bulletion-title{
                flex:0 0 22px;
                height: 12px;
                .bg-image('bulletin');
                background-size: 100% 100%;
            }
            .bulletion-text{
                flex:1;
                font-size: @fontsize-small-s;
                margin-left: 4px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .icon-youjiantou2{
                flex: 0 0 10px;
                font-size: 8px;
            }

        }

    }
</style>